UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Ip+ekPMSoobqKq0QgCbKY7vFgGrbIsOZH+qgycW/Ag=' 
WHERE 
  key_id = '51b0a93ba5279d4c3f14010a1f8ad60a89991704eda991808f8d1ec4dda15217' 
  AND (
    token = '0Ip+ekPMSoobqKq0QgCbKY7vFgGrbIsOZH+qgycW/Ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025