UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7LeEZM6C2BAdsbgY+nydsAA19MWXLoeF9czx0wVOqXU=' 
WHERE 
  key_id = 'bd7cfb2602c710977056f321bea57974ce55bd636fa0f6dae795f10755642a2d' 
  AND (
    token = '7LeEZM6C2BAdsbgY+nydsAA19MWXLoeF9czx0wVOqXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036