UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPSwRzXQh2C2X+Dn6X9ymxQzM/p37E6KR5KtPMn0Uc4=' 
WHERE 
  key_id = 'baf075f0ae2946cbf563207af1c510a2d90b27ff1b7d06e4492bef4cec1536c8' 
  AND (
    token = 'oPSwRzXQh2C2X+Dn6X9ymxQzM/p37E6KR5KtPMn0Uc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022