UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EyZPCz4deZm+fukNQB/UaADfW9Na3kfpIFvzUn21cw4='
WHERE
key_id = '8787ef3b655fdbc1f46b993d18328ac5ba071035b82338949c1ad83a767c91d2'
AND (
token = 'EyZPCz4deZm+fukNQB/UaADfW9Na3kfpIFvzUn21cw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)