UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N1hoOO6jsxbXpzJo6XpDttIwgjYd+CWb0LZBZQ8sehk=' 
WHERE 
  key_id = 'eca98dd603d548502d475d51608547090b16160f00622605d73e9add85962582' 
  AND (
    token = 'N1hoOO6jsxbXpzJo6XpDttIwgjYd+CWb0LZBZQ8sehk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019