UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3pgwxr06tD4Ay3KS3/nf4DlGj1s5u9n76wWtlLzrZBg='
WHERE
key_id = 'c9f4599da82811f77a95e32215e4bb38350fce1b16db441b4437a9b5142e7c20'
AND (
token = '3pgwxr06tD4Ay3KS3/nf4DlGj1s5u9n76wWtlLzrZBg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)