UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uGMvx+tSrSIwbRcl5+pVIQP/hw89zyeICZ0gS2m6Cjs='
WHERE
key_id = '4f80df83450f57fdbfee1abb379e9e26a1897b5397d6269f6f286ca06878f2f6'
AND (
token = 'uGMvx+tSrSIwbRcl5+pVIQP/hw89zyeICZ0gS2m6Cjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)