UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TzRj+8AhYDXqGSkffNfaumvjTYoWdJLb0VWQTidJzDU='
WHERE
key_id = 'b0a776d527887e0ef7eb2537e9e9d71babab3bb07626f48daec10cad9757fa7a'
AND (
token = 'TzRj+8AhYDXqGSkffNfaumvjTYoWdJLb0VWQTidJzDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)