UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eF/NXM3M4YoII5gJrE/xdhSYB4ePWiiLDxzIFWvLvgQ=' 
WHERE 
  key_id = '9ca5b768682c8deb30d51baa56ae07064e224380f8105d5190efaada3ee2daab' 
  AND (
    token = 'eF/NXM3M4YoII5gJrE/xdhSYB4ePWiiLDxzIFWvLvgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030