UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZ9U3kqFKUhC0XqYY/AY+vxmwbNF6SJo1E6auBFg7ds=' 
WHERE 
  key_id = '02b550dd416500a977b39ed29c684586fdd383dbdff58517c077ed4f0ce26e3e' 
  AND (
    token = 'WZ9U3kqFKUhC0XqYY/AY+vxmwbNF6SJo1E6auBFg7ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026