UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AjJmm6ULyvXhww5VuwxdwJDjgBtl4Q5mWOIKKULE6+g='
WHERE
key_id = '357de0fe700c9b4b0f52323778fdcfe57c1621671a038b4d8eac309f8411504f'
AND (
token = 'AjJmm6ULyvXhww5VuwxdwJDjgBtl4Q5mWOIKKULE6+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)