UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h4BCAjIskrgoRYUuShXvG768TmCDZYUsHfD0Wf3S9eo=' 
WHERE 
  key_id = '8b91ee24e2de9847c82616ed3e20222e004bdc20753dcf35f0677a62fcf36866' 
  AND (
    token = 'h4BCAjIskrgoRYUuShXvG768TmCDZYUsHfD0Wf3S9eo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038