UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mlw9ct13zo2wgy8NyARCZAtBJXuoIakqdgw5t3PmbMQ='
WHERE
key_id = '101f8140bf6124511e169b4dcfdf8f1e8c45c9d839ca524ea7702e7a7afd566e'
AND (
token = 'mlw9ct13zo2wgy8NyARCZAtBJXuoIakqdgw5t3PmbMQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)