UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6LGHz6hOyCsdM/6CFG1Bfty3VIdn6kbnWkc50P0rKzw='
WHERE
key_id = '0ba2ac721ff7c2f8879059546142dbf7877db3162f56071a295e43289f8b1839'
AND (
token = '6LGHz6hOyCsdM/6CFG1Bfty3VIdn6kbnWkc50P0rKzw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)