UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tb24q3rBVQpS4TAGQbJkV8xyi7ju6cXeZsAvC5YDHTY='
WHERE
key_id = '970262d012243d66249843685978c1c6d59359cab03f75ff84f3e051c76f0569'
AND (
token = 'Tb24q3rBVQpS4TAGQbJkV8xyi7ju6cXeZsAvC5YDHTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)