UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PgJDv+AKB0toIj5f59tLoZNXn44k/8kiqr1G12nRpr8='
WHERE
key_id = 'f5649dd595f9168262700c29d92f86a203716ca59ed6933c87b1fe51393173e4'
AND (
token = 'PgJDv+AKB0toIj5f59tLoZNXn44k/8kiqr1G12nRpr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)