UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NuQPNbwkS42OQuUkZM8Sx3HVOns3RkmWt2gZfX6McYY='
WHERE
key_id = '388086325a8236903eee7fdb722ce8bcda95f0a629c6e12e44f14782742c1ad3'
AND (
token = 'NuQPNbwkS42OQuUkZM8Sx3HVOns3RkmWt2gZfX6McYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)