UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wdzMRDSFY9gDnZneuQHSPoHkjfTbYiZalbGNjwk0Z6Q='
WHERE
key_id = '5f87710c3cf04da5bee227c346fd1bc321be5c7d59507b64b2f859ae548b8b1d'
AND (
token = 'wdzMRDSFY9gDnZneuQHSPoHkjfTbYiZalbGNjwk0Z6Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)