UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm6dqwCYIAhXAigqJGjfl93Rt1xTAk9dGD2cEZ0G2ZjA='
WHERE
key_id = '3ad196cc0a6022e19f3423c3ee9e364dc2ae51a8091a1a21aceafdb4beef8b1d'
AND (
token = 'm6dqwCYIAhXAigqJGjfl93Rt1xTAk9dGD2cEZ0G2ZjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)