UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o0IWLYUAkCoNz/tEXk75LSAar/ZxYOuf7L7q7MchlYU=' 
WHERE 
  key_id = 'cabc33fec5401b9c29b0345f47904f4289877db9c31e8bf6d7b359bf5ff329fe' 
  AND (
    token = 'o0IWLYUAkCoNz/tEXk75LSAar/ZxYOuf7L7q7MchlYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032