UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w16/05wDszD2xnpBFGonbkgPVgEqMh2DsRt5m0dnnhE=' 
WHERE 
  key_id = 'c569ec04b35a2a1a3ae4e788e64f7f27ec310fd252a543cea8c28604695a45bd' 
  AND (
    token = 'w16/05wDszD2xnpBFGonbkgPVgEqMh2DsRt5m0dnnhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026