UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FaUFRlmVM6h6deqdKvs3rragtC3wGfZTzmIUZxkVXYE='
WHERE
key_id = '6f9aed34ab73bb0c713ad8ef5baa415ea998151ec0c7452810eb1d40ce4ed24b'
AND (
token = 'FaUFRlmVM6h6deqdKvs3rragtC3wGfZTzmIUZxkVXYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)