UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o/PEngiNNxmjluhCT3qwjwVSlPAVMWbO63QAyhYzboE=' 
WHERE 
  key_id = 'd0e5b2e483b1bfb10158ce522d390c096187318d9b1b1d7d76c87899b37dca62' 
  AND (
    token = 'o/PEngiNNxmjluhCT3qwjwVSlPAVMWbO63QAyhYzboE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046