UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mie2OeS97laghgKi02DcoNmB05OmnYRogtUm6k+lwOA=' 
WHERE 
  key_id = '9e2f97c0d603a6f54e964df38dcfb3dfbb846eaea188992ae0b68458b7f2ef7c' 
  AND (
    token = 'mie2OeS97laghgKi02DcoNmB05OmnYRogtUm6k+lwOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041