UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qEreJaDI8HN6H9GmLCkexibY2bie7cfTyWz/QPB8ooU='
WHERE
key_id = '42f31dcd032340e5e13e0d5fb2a12f0dcfd2896f32a1e57b2936d7ad167e81e8'
AND (
token = 'qEreJaDI8HN6H9GmLCkexibY2bie7cfTyWz/QPB8ooU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)