UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gZw0GjtXhAYXsLNj0coUAHcPr/94v56071evUd4h4rA='
WHERE
key_id = 'aa57c872cf96e32183631945ee2f561e8880ca1f54325726b851da27bf7c47ff'
AND (
token = 'gZw0GjtXhAYXsLNj0coUAHcPr/94v56071evUd4h4rA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)