UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PbjuHNuolsDw9ZAV1lfg3uwGIkAv6FpiBETv3m+tXio='
WHERE
key_id = 'c8d1150a88c5b334ee0967489b89ea7ebd7a2a63091919955d4292669d6d493e'
AND (
token = 'PbjuHNuolsDw9ZAV1lfg3uwGIkAv6FpiBETv3m+tXio='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)