UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AkhOwC4z/6NHS2eAuHAPhzH5MLsRthwPcxjwXHvsGbQ='
WHERE
key_id = 'c51b16c710038f010b4307ee95d57336b6958297e03e052ccb45f46be9107596'
AND (
token = 'AkhOwC4z/6NHS2eAuHAPhzH5MLsRthwPcxjwXHvsGbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)