UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dKDVidlrQ0HBXZ1p+0VMqpGA2AMkab/LDZrs19hW7XM='
WHERE
key_id = '1b1943c8dc5288a2a13eb7bbde5d78f09e6b78e635d251f37458572e1a7e05dd'
AND (
token = 'dKDVidlrQ0HBXZ1p+0VMqpGA2AMkab/LDZrs19hW7XM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)