UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bKBFBSRlM1c2n1mCthWe2NjEaVWboehYnRcjEIlcjRo=' 
WHERE 
  key_id = 'f0946317a122f0881221b15eaa771852c05a59a01bbd8a8f262911e4c7f4aa20' 
  AND (
    token = 'bKBFBSRlM1c2n1mCthWe2NjEaVWboehYnRcjEIlcjRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038