UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MRiC4vVb6IMj0uUbXBrDyoglo5iUR6EIBa4M6RrGB4A=' 
WHERE 
  key_id = 'dacf582c7c671c4556a3554a3e6839f4a2a65257181784a3a46718f39b87974c' 
  AND (
    token = 'MRiC4vVb6IMj0uUbXBrDyoglo5iUR6EIBa4M6RrGB4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027