UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3SUH+qL4uubvrR+euhshfolCjnWTbnWUG8P8fOpwkos=' 
WHERE 
  key_id = '524f59e6865508265adf02edeaa0c5562583bcf5c9fbdc14c6735397e96267a3' 
  AND (
    token = '3SUH+qL4uubvrR+euhshfolCjnWTbnWUG8P8fOpwkos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038