UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BhQM+451Ll+wWTRhcRUqV0ve4evYRL1Y/txHSi7k5D8=' 
WHERE 
  key_id = 'd6c83ba556af8a5758ee052aaf3d836d17228e9345ed30e32c2c806cf3ef1fa1' 
  AND (
    token = 'BhQM+451Ll+wWTRhcRUqV0ve4evYRL1Y/txHSi7k5D8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031