UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zXM2INFNOl+slS5v6tA3r1LjkxrpJ4uFfGHa11SlkEo=' 
WHERE 
  key_id = '376e467389663da92f166111fff8154c98b48229a5715aa874073df011807810' 
  AND (
    token = 'zXM2INFNOl+slS5v6tA3r1LjkxrpJ4uFfGHa11SlkEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023