UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LxpBkVt/8j0mrALZyEglodTQBGqXagdjPOyTbF4uPc0=' 
WHERE 
  key_id = 'd402a5243db3e4de4581654e5438c2b1b3c74e0161b984296fa3f3f086d5ddfb' 
  AND (
    token = 'LxpBkVt/8j0mrALZyEglodTQBGqXagdjPOyTbF4uPc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066