UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fr+PqZEWyyTQ/zfcnyAl0F9bILRygXT4lf7/S8hPxc0=' 
WHERE 
  key_id = '1014ed0de3a19026e9ca3f56d288589b54633743228a3f3282b0e60353126aaf' 
  AND (
    token = 'fr+PqZEWyyTQ/zfcnyAl0F9bILRygXT4lf7/S8hPxc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028