UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LWuFd5CfpipzizYeAPeF1xZTc1eFbb1hQAyZF19VvpI='
WHERE
key_id = '2aef01328bf7f96de041f7900149bc3937c452537bee527a221dc812f20185f2'
AND (
token = 'LWuFd5CfpipzizYeAPeF1xZTc1eFbb1hQAyZF19VvpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)