UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ta1Z+7uJ5+Bd8hamWcFJPg81K2S+Rjtp737baYDZ0DA='
WHERE
key_id = 'c6585f1099eafed16004457ab3d209bcba881b09d3c7f9e59cf8691624929b66'
AND (
token = 'ta1Z+7uJ5+Bd8hamWcFJPg81K2S+Rjtp737baYDZ0DA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)