UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y2HDVTs+utDQl4fz7zzvaHyXveQRhjOd9Lscl2zrdVE=' 
WHERE 
  key_id = '28ca0174df7464af350031ede712306e7e9f697dbd32effa5582679900d68288' 
  AND (
    token = 'Y2HDVTs+utDQl4fz7zzvaHyXveQRhjOd9Lscl2zrdVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030