UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2jRd5mn8y23mSkxDCtOK/ff/o7uoOD/l6NWqctaO+t8=' 
WHERE 
  key_id = '213ca2ceeb7565f9d9c130f8aa8fa38c1e2e59e7b478770c8fac6e1626d179bd' 
  AND (
    token = '2jRd5mn8y23mSkxDCtOK/ff/o7uoOD/l6NWqctaO+t8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068