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