UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lnSpQVlDcgiMw0pm+8qAVJGulMX/qSFKJzJ/rIi15sI=' 
WHERE 
  key_id = 'd7187eee87acd453d9a1d9501b63727bbb58f913efb525692f5e13fa81b95018' 
  AND (
    token = 'lnSpQVlDcgiMw0pm+8qAVJGulMX/qSFKJzJ/rIi15sI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045