UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVWhmrvR0GdHv2sSGRYf71+C4wEKUl96OiJHeSS7xSM=' 
WHERE 
  key_id = '97a62e579a0d0a111b6e53b2e5025411e0c5435a46ea8a417a62e7db99e8ccf7' 
  AND (
    token = 'gVWhmrvR0GdHv2sSGRYf71+C4wEKUl96OiJHeSS7xSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025