UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIZ1c8Rc0OzahefJMTh6vKmsViqdrGA0XDP+pn/7NCI='
WHERE
key_id = 'ecca617ef77fd25a759c51c3f5f492f858d7be60899029e7622269d20a1e8e3c'
AND (
token = 'dIZ1c8Rc0OzahefJMTh6vKmsViqdrGA0XDP+pn/7NCI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)