UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uvnKTTYpGd4RrAOhEoV6N/gWqQ//aSKuPNLsBfJ/J3s=' 
WHERE 
  key_id = '978c2d984092fdb0af162bd100d467899f43777cce381dae1a2f7c06af3ef7da' 
  AND (
    token = 'uvnKTTYpGd4RrAOhEoV6N/gWqQ//aSKuPNLsBfJ/J3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029