UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'My+T4shhQkpyBfZz8fZC1zIqrRfEGUOnXrhSX4CRmho=' 
WHERE 
  key_id = '9a52dbe00380321991627b46451d2f488aab1351c79d4bf6a76e4d9ce31ea721' 
  AND (
    token = 'My+T4shhQkpyBfZz8fZC1zIqrRfEGUOnXrhSX4CRmho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032