UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r+Y5PNiiQtbh3yhRTNzFA3fm9xh+Sje5W8RakmtlaDU=' 
WHERE 
  key_id = 'ea8b5327f3994302bdc56a162176a1806ed4a96eef497ff645df7544daecff04' 
  AND (
    token = 'r+Y5PNiiQtbh3yhRTNzFA3fm9xh+Sje5W8RakmtlaDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038