UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ClT68v52ecK0CSOKzQ6zHf+XgT7bLyC8xZD1vYOCy68=' 
WHERE 
  key_id = '77411b19a0b9d8d79c0a6b642eb9f51b3bb57a10d53903948bdb595eab290e16' 
  AND (
    token = 'ClT68v52ecK0CSOKzQ6zHf+XgT7bLyC8xZD1vYOCy68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038