UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XhJzEJdhqic+BQaJMNm7ghsZO9bamk28bZL58U+c6og='
WHERE
key_id = '38d7369cac7c50ec3078c7f0df11385e2c0276389e94554890755e4b4b481b61'
AND (
token = 'XhJzEJdhqic+BQaJMNm7ghsZO9bamk28bZL58U+c6og='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)